package com.czl.elm.rabbitmq;

import com.czl.elm.service.ISeckillService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class MQrecevice {
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private ISeckillService seckillService;

    @RabbitListener(queues = "seckillQueue")
    public void receviceSeckillMsg(Map<String,String> msg){
        String phoneName=msg.get("phoneName");
        String seckillId=msg.get("SeckillId");

        seckillService.doSeckill(seckillId,phoneName);

    }
}
